# === Documentation
-DOCS := index faq config guide manifest native-build
+DOCS := index faq config guide manifest native-build pkgid-spec
DOC_DIR := target/doc
DOC_OPTS := --markdown-no-toc \
--markdown-css stylesheets/normalize.css \
--manifest-path PATH Path to the manifest to the package to clean
-v, --verbose Use verbose output
-Given a <pkgid> argument, print out the fully qualified package id specifier.
-This command will generate an error if <pkgid> is ambiguous as to which package
-it refers to in the dependency graph. If no <pkgid> is given, then the pkgid for
+Given a <spec> argument, print out the fully qualified package id specifier.
+This command will generate an error if <spec> is ambiguous as to which package
+it refers to in the dependency graph. If no <spec> is given, then the pkgid for
the local package is printed.
This command requires that a lockfile is available and dependencies have been
Some(name) => {
let mut to_avoid = HashSet::new();
let dep = try!(resolve.query(name.as_slice()));
- fill_with_deps(&resolve, dep, &mut to_avoid);
if aggressive {
fill_with_deps(&resolve, dep, &mut to_avoid);
} else {
$ cargo update color # updates just 'color'
```
-This will write out a new `Cargo.lock` with the new version information.
+This will write out a new `Cargo.lock` with the new version information. Note
+that the argument to `cargo update` is actually a
+[Package ID Specification](pkgid-spec.html) and `color` is just a short
+specification.
# Overriding Dependencies
```
language: rust
-script:
- - cargo build --verbose
- - cargo test --verbose
```
--- /dev/null
+% Package ID Specifications
+
+# Package ID Specifications
+
+Subcommands of cargo frequently need to refer to a particular package within a
+dependency graph for various operations like updating, cleaning, building etc.
+To solve this problem, cargo supports Package ID Specifications. A specification
+is a string which is used to uniquely refer to one package within a graph of
+packages.
+
+## Specification grammar
+
+The formal grammar for a Package Id Specification is:
+
+```notrust
+pkgid := pkgname
+ | [ proto "://" ] hostname-and-path [ "#" ( pkgname | semver ) ]
+pkgname := name [ ":" semver ]
+
+proto := "http" | "git" | ...
+```
+
+Here, brackets indicate that the contents are optional.
+
+## Example Specifications
+
+These could all be references to a package `foo` version `1.2.3` from the
+registry at `crates.io`
+
+| pkgid | name | version | url |
+|-------------------------------:|:------:|:---------:|:--------------------:|
+| `foo` | foo | * | * |
+| `foo:1.2.3` | foo | 1.2.3 | * |
+| `crates.io/foo` | foo | * | *://crates.io/foo |
+| `crates.io/foo#1.2.3` | foo | 1.2.3 | *://crates.io/foo |
+| `crates.io/bar#foo:1.2.3` | foo | 1.2.3 | *://crates.io/bar |
+| `http://crates.io/foo#1.2.3` | foo | 1.2.3 | http://crates.io/foo |
+
+## Brevity of Specifications
+
+The goal of this is to enable both succinct and exhausitive syntaxes for
+referring to packages in a dependency graph. Ambiguous references may refer to
+one or more packages. Most commands generate an error if more than one package
+could be referred to with the same specification.
pre.rust .macro, pre.rust .macro-nonterminal { color: #3E999F; }
pre.rust .lifetime { color: #B76514; }
code span.s1 { color: #2AA198; }
+
+table th { border-bottom: 1px solid black; }
+table td, table th { padding: 5px 10px; }